﻿using System.Reflection;
using System.Reflection.Emit;

namespace Dynamic.Api.Utils
{
    public static class ReflectionHelper
    {
        static readonly MethodInfo GetTypeFromHandleMethodInfo = typeof(Type).GetMethod("GetTypeFromHandle");

        public static void EmitType(ILGenerator iLGenerator, Type type)
        {
            iLGenerator.Emit(OpCodes.Ldtoken, type);
            iLGenerator.Emit(OpCodes.Call, GetTypeFromHandleMethodInfo);
        }
    }
}
